<?php
defined('IN_TS') or die('Access Denied.');
$userid = aac('user')->isLogin();
$groupid = intval($_GET['groupid']);
$arrUser = aac('user')->find('user_info',array('userid'=>$userid));
if(!$groupid){
	$groupid = intval($_GET['id']);
}
$arrGroup = aac('group')->find('group',array('groupid'=>$groupid));
switch($arrGroup['province']){
	case '北京':
		$city = '北京';
		break;
	case '上海':
		$city = '上海';
		break;
	case '天津':
		$city = '天津';
		break;
	default:
		switch($arrGroup['city']){
			case '佛山':
				$city = '广州';
				break;
			default:
				$city = $arrGroup['city'];
				break;
		}
		break;
}
$type =intval($_GET['type']);
$strGroupUser = aac('group')->find('group_user','userid='.$userid.' and groupid='.$groupid.' and (isstock=-1 or isstock=1 or isstock=2)');
$meeting =  aac('system')->find('system_options',array('optionname'=>'meetingroom'));

if(!$strGroupUser&&$userid<>1329){
	tsNotice('你还没在微澜社区报名'.$arrGroup['groupname'].'馆东，请补报！',  '点击报名', tsUrl('my','setting',array('ts'=>'base','groupid'=>$groupid,'jointype'=>2,'isdonate'=>1)));
}
$strGroupUser1 = aac('group')->find('group_user',array(
	'userid'=>$userid,
	'groupid'=>$groupid,
	'isvo'=>1
));
if($strGroupUser['isstock']==-1){

	aac('group')->update('group_user',array(
		'userid'=>$userid,
		'groupid'=>$groupid,
	),array(
			'isstock'=>1
		)
	);

	$groupids = getGroupIds($userid);

	$count_sto=$new['group']->findCount('group_user','(isstock=1 or isstock=2) and groupid='.$groupid);
	$new['group']->update('group',array(
		'groupid'=>$groupid
	),array(
			'count_sto'=>$count_sto
		)
	);

	aac('user')->update('user_info',array('userid'=>$userid),array('isstock'=>1,'groupids'=>$groupids));

	$num = aac('group')->findCount('group_user','groupid='.$groupid.' and (isstock=1 or isstock=2)');

}
$strTopic = aac('group')->find('group_topic',array(
	'topicid'=>289,
));
$strTopic['content'] = tsDecode($strTopic['content'],$tp);
$title = $title = '欢迎'.$arrGroup['groupname'].'新馆东';;
include template("newstock");